package com.mit.wx.wx.dto;

import com.mit.wx.util.WxXmlUtil;
import com.mit.wx.util.xml.CDataConverter;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import lombok.Data;

/**
 * 微信接收消息
 *
 * @author 郭文梁
 * <p> Create by 郭文梁</p>
 * <p>FOR: 微信接收消息</p>
 */
@Data
@XStreamAlias("xml")
public class SourceMessage {
    public static SourceMessage formXML(String xml) {
        return WxXmlUtil.parseMessageXML(xml);
    }

    @XStreamAlias("ToUserName")
    @XStreamConverter(CDataConverter.class)
    private String toUserName;
    @XStreamAlias("FromUserName")
    @XStreamConverter(CDataConverter.class)
    private String fromUserName;
    @XStreamAlias("CreateTime")
    private String createTime;
    @XStreamAlias("MsgType")
    @XStreamConverter(CDataConverter.class)
    private String msgType;
    @XStreamAlias("Content")
    @XStreamConverter(CDataConverter.class)
    private String content;
    @XStreamAlias("MsgId")
    private String msgId;
    @XStreamAlias("MediaId")
    @XStreamConverter(CDataConverter.class)
    private String mediaId;
    @XStreamAlias("PicUrl")
    @XStreamConverter(CDataConverter.class)
    private String picUrl;
}
